<template>
  <!-- 合同信息 -->
  <div id="contractDetail">
    <el-form :model="form" label-width="100">
      <el-form-item label="备注:" style="width: 100%">
        <p>{{ form.remark }}</p>
      </el-form-item>
      <el-form-item label="附件:" style="width: 100%">
        <!-- <p>{{ form.otherFiles }}</p> -->
        <other-files ref="otherFiles" :files="form.otherFiles"></other-files>
      </el-form-item>
      <div class="button" v-if="form.status == 0 && isReloadData">
        <el-button type="primary" @click="toEdit">编辑</el-button>
      </div>
      <!-- <el-form-item label="创建人:">
        <p>{{ form.username }}</p>
      </el-form-item>
      <el-form-item label="创建时间:">
        <p>{{ form.createTime }}</p>
      </el-form-item> -->
    </el-form>
  </div>
</template>
<script>
import otherFiles from '@/components/otherFiles'
export default {
  name: 'contractDetail',
  data () {
    return {
      form: {},
      isReloadData: true//局部刷新标识
    }
  },
  components: {
    otherFiles,
  },
  props: {
    data: {
      type: Object,
      required: true,
      default: () => { return {} }
    }
  },
  watch: {
    data (val) {
      if (val) {
        console.log(val)
        this.form = val
      }
    }
  },
  mounted () {

  },
  methods: {
    toEdit () {
      this.$router.push({
        path: '/contract/contractManagement/contractAdd',
        query: {
          mode: 'edit',
          id: this.form.id
        }
      })
    },
    relodPart () {
      this.isReloadData = false
      this.$nextTick(() => {
        this.isReloadData = true
      })
    }
  }

}
</script>
<style lang='scss' scoped>
.button {
  margin: 20px 0 20px 40px;
}
</style>
